<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    function Person(name) {
        this.name = name
    }

    // 修改原型
    Person.prototype.getName = function () {
        console.log(this.name)
    }

   /* let p = new Person("张三")
    console.log(p.__proto__ === Person.prototype) // true
    console.log(p.__proto__ === p.constructor.prototype) // false*/

    // 重写原型
    Person.prototype.getName = function () {
        console.log(this.name)
    }
    let p = new Person("李四")  // 这里的构造并不是上面的构造
    console.log(p.__proto__ === Person.prototype) // true
    console.log(p.__proto__ === p.constructor.prototype) // false constructor的指向改为object了
</script>
</body>
</html>